<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>self 修饰符</title>
    <style>
        .zone {
            background-color: silver;
            height: 200px;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="zone" @click="divClicked">
        <button @click="buttonClicked">无任何修饰符</button>
    </div>

    <hr>

    <!--  只处理自身的事件  -->
    <div class="zone" @click.self="divClicked">
        <button @click="buttonClicked">有 self 修饰符</button>
    </div>

</div>
<script type="module">
    import {createApp} from "../../../../../js/vue.esm-browser.js";

    const app = createApp({
        setup() {
            function divClicked() {
                console.log("点击了 div");
            }

            function buttonClicked() {
                console.log("点击了按钮");
            }

            return {
                divClicked,
                buttonClicked,
            }
        }
    })

    app.mount("#app")
</script>
</body>
</html>